<template>
  <!-- 招生信息 -->
  <div class="tabdetial">
    <Nav></Nav>
    <div class="banner-wrap">
      <img class="banner" :src="tabdetailBg" />
      <!-- <div class="btn">点击查看</div> -->
    </div>
    <div class="wrap">
      <div class="tabs">
        <div class="tabs-title">三位一体<span></span>招生信息</div>
        <div class="tabs-subTitle">
          Gaobangbabg, paint a picture of life and draw a blueprint for the
          future.
        </div>
      </div>

      <div class="areas">
        <div class="areas-item">
          <div class="title">地区选择:</div>
          <div class="list">
            <div class="item" :class="{ active: currentIndex == 0 }" @click="changeCity(0,'')">全部</div>
            <div class="list" v-for="(item) in info.city" :key="item">
               <div class="item" v-for="(project,index1) in item"  :class="{ active: currentIndex == index1 + 1 }" :key="project" @click="changeCity(index1 + 1,project)">{{project}}</div>
            </div>
          </div>
        </div>
        <div class="areas-item">
          <div class="title">年份选择:</div>
          <div class="list">
            <div class="item" :class="{ active: currentYearIndex == 0 }"  @click="changeYear(0, '')">全部</div>
            <div class="item" :class="{ active: currentYearIndex == index + 1 }"  @click="changeYear(index+1,item)" v-for="(item,index) in info.years" :key="item">
            {{item}}
            </div>
          </div>
        </div>
        <div class="areas-item">
          <div class="title">分类选择:</div>
          <div class="list">
            <div class="item" :class="{ active: currentTypeIndex == 0 }" @click="changeType(0,'')">全部</div>
            <div class="list" v-for="item in info.type" :key="item">
               <div class="item" v-for="(project,index1) in item" :class="{ active: currentTypeIndex == index1 + 1 }" :key="project" @click="changeType(index1 + 1,project)">{{index1}}</div>
            </div>
          </div>
        </div>
      </div>

      <div class="schools">
        <div
          class="schools-wrap"
          v-for="(item, index) in info.list"
          :key="item"
        >
          <schoolProject :introduce="item" :index="index" type="zs"></schoolProject>
        </div>
      </div>

       <div class="page">
    <!-- <van-pagination
        v-model="currentPage"
        :total-items="125"
        :show-page-size="3"
        force-ellipses
        /> -->
    </div>

    </div>

   
    <Footer></Footer>
  </div>
</template>

<script setup>
import Footer from '../../components/pc/Footer.vue';
import Nav from '../../components/pc/nav.vue';
import schoolProject from '../../components/pc/schoolProject.vue';
import introduceProject from '../../components/pc/introduceProject.vue';
import consultationProject from '../../components/pc/consultationProject.vue';
import { onMounted, ref } from 'vue';
import { getTrinityPC } from '../../api/apiList/pcApi.js';
import tabdetailBg from '../../assets/pc/enrollmentInfoPc-bg.jpg';
import homepageTab2 from '../../assets/pc/homepage-tab2.png';
import homepageTab3 from '../../assets/pc/homepage-tab3.png';
import homepageTab4 from '../../assets/pc/homepage-tab4.png';
import homepageTab5 from '../../assets/pc/homepage-tab5.png';

import { getAdmissionsPc } from '../../api/apiList/pcApi.js';
const currentIndex = ref(0)
const currentTypeIndex = ref(0)
const currentYear = ref('')
const currentType = ref('')
let currentCity = ref('');
const currentYearIndex = ref(0)
let info = ref({});
// let currentIndexBg = ref(-1);

onMounted(async () => {
   getAdmissionsList()
});


const changeType = (index,project) => {
  currentTypeIndex.value = index
  currentType.value = project
  getAdmissionsList(currentCity.value,currentYear.value,currentType.value)
}

const changeCity = (index,project) => {
  currentIndex.value = index
  currentCity.value = project
  getAdmissionsList(currentCity.value,currentYear.value,currentType.value)
}
const changeYear = (index,item) => {
  currentYearIndex.value = index
  currentYear.value = item
  getAdmissionsList(currentCity.value,item,currentType.value)
}

const getAdmissionsList = (city = "", years = "",types="") => {
  getAdmissionsPc({ city, years ,types}).then((res) => {
    const { result } = res;
    info.value = result;
  });
}
</script>

<style lang="less" scoped>
.tabdetial {
  
    .page {
        display: flex;
        align-items: flex-end;
        justify-content:flex-end;
    }
  .wrap {
    position: relative;
    width: 1201Px;
    margin: 0 auto;
    .tabs {
      margin-top: 40Px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      .tabs-title {
        display: flex;
        align-items: center;
        font-size: 28Px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #666666;
        line-height: 40Px;
        margin-bottom: 3Px;
        span {
          width: 12Px;
          height: 12Px;
          background: #d8d8d8;
          border-radius: 12Px;
          margin: 0 32Px;
        }
      }
      .tabs-subTitle {
        font-size: 22Px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #999999;
        line-height: 30Px;
        margin-bottom: 37Px;
      }
    }
    .areas {
      margin-bottom: 30Px;
    .areas-item {
        display: flex;
        align-items: flex-start;
    }
      .title {
        font-size: 20Px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #000000;
        line-height: 40Px;
        margin-right: 20Px;
        flex: 0 0 100Px;
        margin-top:3Px;
      }
      .list {
        display: flex;
        flex-wrap: wrap;
        // border-bottom: 1Px solid #979797;
        .item {
          font-size: 20Px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: #999999;
          line-height: 28Px;
          margin: 0 20Px;
          margin: 10Px;
          cursor: pointer;
        }
         .active {
            // background: linear-gradient(180deg, #EEEEEE 0%, #CCCDFF 100%);
            color: #af63ff;
        }
      }
    }
  }
  .banner-wrap {
    position: relative;
    width: 100vw;
    height: auto;
  }
  .banner {
    width: 100vw;
    height: auto;
    margin-bottom: 30Px;
  }
}
</style>
